﻿using System;
using System.Runtime.InteropServices;
using System.Security;
using ToolSharp.Windows.Native.SafeHandles;

namespace ToolSharp.Windows.Native
{
	[StructLayout(LayoutKind.Sequential)]
	public struct MEMORY_BASIC_INFORMATION
	{
		public unsafe void* BaseAddress;
		public unsafe void* AllocationBase;
		public uint AllocationProtect;
		public UIntPtr RegionSize;
		public uint State;
		public uint Protect;
		public uint Type;
	}

	[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
	public struct UNICODE_INTPTR_STRING
	{
		public ushort Length;
		public ushort MaxLength;
		public IntPtr Buffer;
		[SecurityCritical]
		public UNICODE_INTPTR_STRING(int stringBytes, SafeLocalAllocHandle buffer)
		{
			throw new NotImplementedException();
		}
		public UNICODE_INTPTR_STRING(int stringBytes, IntPtr buffer)
		{
			throw new NotImplementedException();
		}
	}

	[Serializable, StructLayout(LayoutKind.Sequential)]
	public struct WIN32_FILE_ATTRIBUTE_DATA
	{
		public int fileAttributes;
		public uint ftCreationTimeLow;
		public uint ftCreationTimeHigh;
		public uint ftLastAccessTimeLow;
		public uint ftLastAccessTimeHigh;
		public uint ftLastWriteTimeLow;
		public uint ftLastWriteTimeHigh;
		public int fileSizeHigh;
		public int fileSizeLow;
		[SecurityCritical]
		public void PopulateFrom(WIN32_FIND_DATA findData)
		{
			throw new NotImplementedException();
		}
	}

	[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
	public struct SECURITY_LOGON_SESSION_DATA
	{
		public uint Size;
		public LUID LogonId;
		public UNICODE_INTPTR_STRING UserName;
		public UNICODE_INTPTR_STRING LogonDomain;
		public UNICODE_INTPTR_STRING AuthenticationPackage;
		public uint LogonType;
		public uint Session;
		public IntPtr Sid;
		public long LogonTime;
	}

	[StructLayout(LayoutKind.Sequential)]
	public struct LSA_TRUST_INFORMATION
	{
		public UNICODE_INTPTR_STRING Name;
		public IntPtr Sid;
	}

	[StructLayout(LayoutKind.Sequential)]
	public struct LSA_TRANSLATED_NAME
	{
		public int Use;
		public UNICODE_INTPTR_STRING Name;
		public int DomainIndex;
	}

	[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
	public struct KERB_S4U_LOGON
	{
		public uint MessageType;
		public uint Flags;
		public UNICODE_INTPTR_STRING ClientUpn;
		public UNICODE_INTPTR_STRING ClientRealm;
	}
}
